import Vue from 'vue'
import VueRouter from 'vue-router'
import home from '../views/home.vue'  //同步加载

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: "/home"
  },
  {
    path: '/home',
    name: 'home',
    component: home,
    meta:{
      bottomNav:true,
      backTop:true
    }
  },
  {
    path: '/buy',
    name: 'buy',
    component:()=>import("../views/buy.vue"),  //懒加载
    meta:{
      bottomNav:true
    }
  },
  {
    path: '/car',
    name: 'car',
    component:()=>import("../views/car.vue"),
    meta:{
      bottomNav:false
    }
  },
  {
    path: '/category',
    name: 'category',
    component:()=>import("../views/category.vue"),
    meta:{
      bottomNav:true
    }
  },
  {
    path: '/my',
    name: 'my',
    component:()=>import("../views/my.vue"),
    meta:{
      bottomNav:true
    }
  },
  {
    path: '/bookLists',
    name: 'bookLists',
    component:()=>import("../views/bookLists.vue"),
    meta:{
      bottomNav:true
    }
  },
  {
    path: '/goodDetail',
    name: 'goodDetail',
    component:()=>import("../views/goodDetail.vue"),
    meta:{
      bottomNav:false
    }
  },
  {
    path: '/login',
    name: 'login',
    component:()=>import("../views/login.vue"),
    meta:{
      bottomNav:false
    }
  },
  {
    path: '/register',
    name: 'register',
    component:()=>import("../views/register.vue"),
    meta:{
      bottomNav:false
    }
  },
  {
    path: '/orderForm',
    name: 'orderForm',
    component:()=>import("../views/orderForm.vue"),
    meta:{
      bottomNav:false
    }
  },
  {
    path: '/address',
    name: 'address',
    component:()=>import("../views/address.vue"),
    meta:{
      bottomNav:false
    }
  },
  {
    path: '/searchPage',
    name: 'searchPage',
    component:()=>import("../views/searchPage.vue"),
    meta:{
      bottomNav:false
    }
  },
  {
    path: '/pay',
    name: 'pay',
    component:()=>import("../views/pay.vue"),
    meta:{
      bottomNav:false
    }
  },
  {
    path: '/newCeta',
    name: 'newCeta',
    component:()=>import("../views/newCeta.vue"),
    meta:{
      bottomNav:false
    }
  },
  // {
  //   path: '/about',
  //   name: 'About',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  // }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
